﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using TestMvcForControllerAndAction.Controllers;

namespace TestMvcForControllerAndAction.Infrastructure
{
    public class CustomControllerActivator:IControllerActivator
    {
        public IController Create(System.Web.Routing.RequestContext requestContext, Type controllerType)
        {
            if (controllerType==typeof(ProductController))
            {
                controllerType = typeof (CustomerController);
            }
            return DependencyResolver.Current.GetService(controllerType) as IController;
        }
    }
}